import 'package:flutter_test/flutter_test.dart';
import 'package:lib_wake_lock/lib_wake_lock.dart';
import 'package:lib_wake_lock/lib_wake_lock_platform_interface.dart';
import 'package:lib_wake_lock/lib_wake_lock_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockLibWakeLockPlatform
    with MockPlatformInterfaceMixin
    implements LibWakeLockPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<T?> invokeMethod<T>(String method, [arguments]) {
    // TODO: implement invokeMethod
    throw UnimplementedError();
  }
}

void main() {
  final LibWakeLockPlatform initialPlatform = LibWakeLockPlatform.instance;

  test('$MethodChannelLibWakeLock is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelLibWakeLock>());
  });

  test('getPlatformVersion', () async {
    LibWakeLock libWakeLockPlugin = LibWakeLock.instance;
    MockLibWakeLockPlatform fakePlatform = MockLibWakeLockPlatform();
    LibWakeLockPlatform.instance = fakePlatform;

    expect(await libWakeLockPlugin.getPlatformVersion(), '42');
  });
}
